package bigdata.backend.monitor.warehouse.entity;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;

import java.time.LocalDateTime;

@Data
@TableName("quality_rule")
public class QualityRule {
    @TableId(type = IdType.ASSIGN_ID)
    private Long id;
    private Long datasourceId;
    private String databaseName;
    private Long tableId;
    private String tableName;
    private String ruleName;
    private String ruleCode;
    private String ruleType; // TYPE/ENUM/LENGTH/CUSTOM
    private String simpleCondition; // 简化条件（基础类型校验）
    private String triggerCondition; // Doris 表达式 CUSTOM类型专用
    private Boolean enabled;      // 是否启用
    private String outputFields;  // 输出字段 使用逗号间隔
    private String primaryField = "id";  // 表对应主键字段名
    private String deleteFlag;
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;

    public String getFullTableName() {
        return databaseName + "." + tableName;
    }
}
